using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using Common.Shared.Design;

namespace Common.Shared.Xml.Wddx {
	[WddxRoot("data")]
	public class WddxData : WddxObject {
		
		[WddxElement]
		public override WddxDataTypeObject Value {
			get {
				return base.Value;
			}
			set {
				//if ( value.GetType ( ).IsAssignableFrom(typeof(WddxDataTypeObject)) )
				if ( value.GetType ( ) == typeof ( WddxNull ) || value.GetType ( ) == typeof ( WddxBoolean ) ||
						value.GetType ( ) == typeof ( WddxNumber ) || value.GetType ( ) == typeof ( WddxDateTime ) ||
						value.GetType ( ) == typeof ( WddxString ) || value.GetType ( ) == typeof ( WddxArray ) ||
						value.GetType ( ) == typeof ( WddxStructure ) || value.GetType ( ) == typeof ( WddxRecordset ) ||
						value.GetType ( ) == typeof ( WddxBinary ) ) {
					base.Value = value;
				} else {
					throw new WddxException ( "Unsupported type being added to WddxData object." );
				}
			}
		}

	}
}
